function initBMS()
{
	var myScript= document.createElement("script");
    myScript.type = "text/javascript";
    myScript.src = "http://map.qq.com/api/js?v=2.exp";
    document.body.appendChild(myScript);
    
    window.qq = window.qq || {};
    qq.maps = qq.maps || {};
    window.soso || (window.soso = qq);
    soso.maps || (soso.maps = qq.maps);
    (function () {
        function getScript(src) {
            document.write('<' + 'script src="' + src + '"' +' type="text/javascript"><' + '/script>');
        }
        qq.maps.__load = function (apiLoad) {
            delete qq.maps.__load;
            apiLoad(["http://open.map.qq.com/","2.1.13","",1395539929469,true,"","","apifiles/2/1/13/mods/","apifiles/2/1/13/theme/",[[null,["http://p0.map.gtimg.com/maptilesv2","http://p1.map.gtimg.com/maptilesv2","http://p2.map.gtimg.com/maptilesv2","http://p3.map.gtimg.com/maptilesv2"],null,null,[null,["http://p0.map.gtimg.com/hwaptiles","http://p1.map.gtimg.com/hwaptiles","http://p2.map.gtimg.com/hwaptiles","http://p3.map.gtimg.com/hwaptiles"],null,1]],[null,["http://p0.map.gtimg.com/sateTiles","http://p1.map.gtimg.com/sateTiles","http://p2.map.gtimg.com/sateTiles","http://p3.map.gtimg.com/sateTiles"],1,null],[null,["http://p0.map.gtimg.com/sateTranTiles","http://p1.map.gtimg.com/sateTranTiles","http://p2.map.gtimg.com/sateTranTiles","http://p3.map.gtimg.com/sateTranTiles"],null,null]]],loadScriptTime);
        };
        var loadScriptTime = (new Date).getTime();
        getScript("http://open.map.qq.com/apifiles/2/1/13/main.js");
    })();
}
//initBMS();

function openDefaultWindow(url)
{
	var width=800;
	var height=600;
	var left=(screen.width - width) / 2;
	var top=(screen.height - height) / 2;
	var win = window.open(url, "new", "top="+top+", left="+left+", width="+width+", height="+height+", toolbar=no, menubar=no");
}

function openMainWindow(url, name)
{
	var width	= screen.width;
	var height	= screen.height;
	var left	= 0;
	var top		= 0;
	var params	= "top="+top+
					", left="+left+
					", width="+width+
					", height="+height+
					", toolbar=no, menubar=no";
	var win = window.open(url, name, params);
}

function openPrintWindow(url)
{
	var width   = 800;
	var height  = 600;
	var left    = (screen.width - width) / 2;
	var top     = (screen.height - height) / 2;
	var params	= "top="+top+
					", left="+left+
					", width="+width+
					", height="+height+
					", toolbar=no, menubar=yes, resizable=yes";
	var win = window.open(url, name, params);
}

function closeWindow()
{
	window.opener = null;
	window.open("", "_self");
	window.close();
}

function cookie(name) {    
	var cookieArray=document.cookie.split("; ");     
	var cookie=new Object();    
	for (var i=0;i<cookieArray.length;i++){    
	   var arr=cookieArray[i].split("=");           
	   if(arr[0]==name)return unescape(arr[1]);     
	} 
	return ""; 
} 

function delCookie(name) {
	document.cookie = name+"=;expires="+(new Date(0)).toGMTString();
}

function getCookie(objName){
  var arrStr = document.cookie.split("; ");
  for(var i = 0;i < arrStr.length;i ++){
      var temp = arrStr[i].split("=");
      if(temp[0] == objName) return unescape(temp[1]);
 } 
}
function addCookie(objName,objValue,objHours){
  var str = objName + "=" + escape(objValue);
  if(objHours > 0){
      var date = new Date();
      var ms = objHours*3600*1000;
      date.setTime(date.getTime() + ms);
      str += "; expires=" + date.toGMTString();
 }
 document.cookie = str;
}
function setCookie(name,value) {
  var Days = 30; 
  var exp = new Date();
  exp.setTime(exp.getTime() + Days*24*60*60*1000);
  document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function getCookie(name) {
  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
   if(arr != null) return unescape(arr[2]); return null;
}

function delCookie(name) {
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval=getCookie(name);
  if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

function isEmptyObj(obj){
	return $.isEmptyObject(obj);
}
function jsonEncode(obj) {
	if ($.isEmptyObject(obj)) return;
	return JSON.stringify(obj);
}

function jsonDecode(str) {
	try {
		return JSON.parse(str);
	} catch(e) {
		return new Object();
	}
}

(function(){
	Function.prototype.delay=function(fn,timeout){ 
		fn = fn||null; 
		timeout = timeout||0; 
		var _this = this; 
		var args = []; 
		switch(arguments.length){ 
		case 1: 
			timeout=parseInt(arguments[0]); 
			timeout=isNaN(timeout)?0:timeout; 
			timeout=timeout<0?0:timeout; 
			break; 
		default: 
			for(var i=0;i<arguments.length;i++){ 
				if(i>1){
					args.push(arguments[i]);
				}; 
			}; 
			break; 
		}; 
		var proxy = function(){ 
			_this.apply(fn,args); 
		}; 
		return window.setTimeout(proxy,timeout); 
	}
}())

